package cn.edu.scau.cmi.tangqingning.client;

import java.net.URL;

import cn.edu.scau.cmi.tangqingning.factoryMethod.FactoryController;
import javafx.application.Application;
import javafx.fxml.FXMLLoader;
import javafx.fxml.JavaFXBuilderFactory;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;

public class FactoryClient extends Application {
	@Override
	public void start(Stage primaryStage) {
		try {
			URL location = getClass().getResource("../factoryMethod/factoryMethod.fxml");
			FXMLLoader fxmlLoader = new FXMLLoader();
	        fxmlLoader.setLocation(location);
	        fxmlLoader.setBuilderFactory(new JavaFXBuilderFactory());
	        Parent root = fxmlLoader.load();
			Scene scene = new Scene(root);
			scene.getStylesheets().add(getClass().getResource("../factoryMethod/application.css").toExternalForm());
			primaryStage.setScene(scene);
			FactoryController controller = fxmlLoader.getController();   //获取Controller的实例对象
	        //Controller中写的初始化方法
	        controller.Init();
			primaryStage.setResizable(false);
			primaryStage.setTitle("实验二 工厂方法");
			primaryStage.show();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		launch(args);
	}
}
